﻿// Snippet
// Created 11/12/2009 3:41:14 PM by Andrzej Prazmo.
// andrzej@prazmo.pl
// Copyright (C) 2009. All rights reserved.

using System;
using System.Collections.Generic;
using System.Text;

namespace SnippetCreator
{
    public class Snippet
    {
        public Snippet()
        {
            _header = new SnippetHeader();
            _literals = new List<SnippetLiteral>();
            _code = String.Empty;

        }
        private SnippetHeader _header;

        public SnippetHeader Header
        {

            get { return _header; }

            set { _header = value; }

        }

        private List<SnippetLiteral> _literals = new List<SnippetLiteral>();

        public List<SnippetLiteral> Literals
        {

            get { return _literals; }

            set { _literals = value; }

        }

        private string _code;

        public string Code
        {

            get { return _code; }

            set { _code = value; }

        }

        private string _language;

        public string Language
        {

            get { return _language; }

            set { _language = value; }

        }
    }

    public class SnippetHeader
    {
        public SnippetHeader()
        {
            _title = String.Empty;
            _shortcut = String.Empty;
            _author = Environment.UserName;
            _description = String.Empty;
            _snippetType = @"Expansion";
        }

        private string _title;

        public string Title
        {

            get { return _title; }

            set { _title = value; }

        }

        private string _shortcut;

        public string Shortcut
        {

            get { return _shortcut; }

            set { _shortcut = value; }

        }

        private string _description;

        public string Description
        {

            get { return _description; }

            set { _description = value; }

        }

        private string _author;

        public string Author
        {

            get { return _author; }

            set { _author = value; }

        }

        private string _snippetType;

        public string SnippetType
        {

            get { return _snippetType; }

            set { _snippetType = value; }

        }


    }

    public class SnippetLiteral
    {
        public SnippetLiteral()
        {
            _id = String.Empty;
            _toolTip = String.Empty;
            _default = String.Empty;
            _positions = new List<LiteralPosition>();
        }
        private string _id;

        public string ID
        {

            get { return _id; }

            set { _id = value; }

        }

        private string _toolTip;

        public string ToolTip
        {

            get { return _toolTip; }

            set { _toolTip = value; }

        }

        private string _default;

        public string Default
        {

            get { return _default; }

            set { _default = value; }

        }

        private List<LiteralPosition> _positions;

        public List<LiteralPosition> Positions
        {

            get { return _positions; }

            set { _positions = value; }

        }
    }
    public class LiteralPosition
    {
        public int Start;
        public int Length;
        public int End;

        public LiteralPosition(int start, int length)
        {
            Start = start;
            Length = length;
            End = start + length;
        }
    }
}
